package org.eddm.rule;

import org.eddm.metamodel.MEdge;
import org.eddm.metamodel.MElements;
import org.eddm.metamodel.MNode;
import org.eddm.metamodel.Metamodel;
import org.eddm.metamodel.Metamodels;


public class Rule {

	public String   _id       = "?";
	public String   _level    = "?";
	public String   _object   = "?";	
	public RElement _rElement = null;
	public MNode    _mNode    = null;
	public MEdge    _mEdge    = null;
	
	
	public Rule()
	{
		_rElement = new RElement();
	}
	
	/**
	 * 
	 * @throws Exception
	 */
	public void setMElement() throws Exception
	{
		Metamodel metamodel = Metamodels.getMetamodel();
		MElements mElements = metamodel.mElements;
		
		if(_object.equalsIgnoreCase("node"))
		{
			MNode mNode = mElements.getMNode( _rElement._id);
			_mNode = mNode;
		}
		else if (_object.equalsIgnoreCase("edge"))
		{
			MEdge mEdge = mElements.getMEdge(_rElement._id);
			_mEdge = mEdge;
		}
		else
		{
			throw new Exception("setMElement::Invalid object type"); 
		}
		
	}
	
	
	
}
